<?php 
header("content-type:text/html;charset=utf8");
$pdo = new PDO("mysql:host=127.0.0.1;charset=utf8;dbname=peng",'root','root');
$redis = new Redis();
$redis->connect('127.0.0.1','6379');
$id = $_GET['id'];
if ($redis->get("data_".$id)) {
	echo "redis 查的";
	$data = $redis->get("data_".$id);
	$data = json_decode($data,true);
}
else
{
	$data = $pdo->query("select * from user where id = $id")->fetch();
	$str = json_encode($data);
	$redis->set('data_'.$id,$str);
}



 ?>
 <!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
       
	<center>
		<h1>详情页</h1>
		<table>
			<tr>
				<th>ID</th>
				<th>用户名</th>
				<th>密码</th>
				<th>手机号</th>
				<th>注册时间</th>
			

			</tr>
			
				<tr>
					<td><?php echo $data['id'] ?></td>
					<td><?php echo $data['name'] ?></td>
					<td><?php echo $data['pwd'] ?></td>
					<td><?php echo $data['tel'] ?></td>
					<td><?php echo $data['add_date'] ?></td>
                    
				</tr>
		
			
		</table>
		     
					
	</center>
</body>
</html>